<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <meta name="layout" content="main"/>
    <title>Dodawanie Nowej Płatnośći</title>
</head>
<body>
<div class="nav2">
    <span class="menuButton"><g:link class="list" action="list">Lista Płatności</g:link></span>
</div>
<div class="body">
    <h1>Dodawanie Nowej Płatności</h1>
    <g:if test="${flash.message}">
        <div class="message">${flash.message}</div>
    </g:if>
    <g:hasErrors bean="${payment}">
        <div class="errors">
            <g:renderErrors bean="${payment}" as="list"/>
        </div>
    </g:hasErrors>
    <g:form action="save" method="post">
        <div class="dialog">
            <table class="main">
                <tbody>
                    <tr>
                        <td>
                            <table>
                                <tbody>

                                    <tr class="prop">
                                        <td>
                                            <h2>Dane płatności:</h2>
                                        </td>
                                    </tr>

                                    <tr class="prop">
                                        <td valign="top" class="name">
                                            <label for="dataFaktury">Data Faktury:</label>
                                        </td>
                                        <td valign="top" class="value ${hasErrors(bean: payment, field: 'dataFaktury', 'errors')}">
                                            <g:datePicker name="dataFaktury" value="${payment?.dataFaktury}"></g:datePicker>
                                        </td>
                                    </tr>

                                    <tr class="prop">
                                        <td valign="top" class="name">
                                            <label for="dataZaliczki">Data Zaliczki:</label>
                                        </td>
                                        <td valign="top" class="value ${hasErrors(bean: payment, field: 'dataZaliczki', 'errors')}">
                                            <g:datePicker name="dataZaliczki" value="${payment?.dataZaliczki}"></g:datePicker>
                                        </td>
                                    </tr>

                                    <tr class="prop">
                                        <td valign="top" class="name">
                                            <label for="kwotaPlatnosci">Kwota Platnosci:</label>
                                        </td>
                                        <td valign="top" class="value ${hasErrors(bean: payment, field: 'kwotaPlatnosci', 'errors')}">
                                            <input type="text" id="kwotaPlatnosci" name="kwotaPlatnosci" value="${fieldValue(bean: payment, field: 'kwotaPlatnosci')}"/>
                                        </td>
                                    </tr>

                                    <tr class="prop">
                                        <td valign="top" class="name">
                                            <label for="nrFaktury">Nr Faktury:</label>
                                        </td>
                                        <td valign="top" class="value ${hasErrors(bean: payment, field: 'nrFaktury', 'errors')}">
                                            <input type="text" id="nrFaktury" name="nrFaktury" value="${fieldValue(bean: payment, field: 'nrFaktury')}"/>
                                        </td>
                                    </tr>

                                    <tr class="prop">
                                        <td valign="top" class="name">
                                            <label for="przedmiotPlatnosci">Przedmiot Platnosci:</label>
                                        </td>
                                        <td valign="top" class="value ${hasErrors(bean: payment, field: 'przedmiotPlatnosci', 'errors')}">
                                            <input type="text" id="przedmiotPlatnosci" name="przedmiotPlatnosci" value="${fieldValue(bean: payment, field: 'przedmiotPlatnosci')}"/>
                                        </td>
                                    </tr>

                                    <tr class="prop">
                                        <td valign="top" class="name">
                                            <label for="student">Student:</label>
                                        </td>
                                        <td valign="top" class="value ${hasErrors(bean: payment, field: 'student', 'errors')}">
                                            <g:select optionKey="id" from="${Student.list()}" name="student.id" value="${payment?.student?.id}"></g:select>
                                        </td>
                                    </tr>

                                    <tr class="prop">
                                        <td valign="top" class="name">
                                            <label for="terminPlatnosci">Termin Platnosci:</label>
                                        </td>
                                        <td valign="top" class="value ${hasErrors(bean: payment, field: 'terminPlatnosci', 'errors')}">
                                            <g:datePicker name="terminPlatnosci" value="${payment?.terminPlatnosci}"></g:datePicker>
                                        </td>
                                    </tr>

                            </table>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
        <span class="button"><input class="icon-button-ok" type="submit" action="create" value="Zapisz"/></span>
        <span class="button"><g:actionSubmit class="icon-button-cancel" action="list" value="Anuluj"/></span>
    </g:form>
</div>
</body>
</html>
